<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!--  //1、绑定点击事件
        //2、随机生成一个RGB的颜色值
        //3、修改body标签的背景色(document.body.style.backgroundColor = 'rgb(1,1,1)') -->

        <button class="btn">点击按钮切换背景颜色</button>
        <script>
            var btn=document.getElementsByClassName("btn")[0];
            function randomNum(max,min){
                return parseInt(Math.random()*(max+1-min)+min)
            }
            btn.onclick=function(){
                document.body.style.backgroundColor = `rgb(${randomNum(0,225)},${randomNum(0,225)},${randomNum(0,225)})`;
                btn.style.color = `rgb(${randomNum(0,225)},${randomNum(0,225)},${randomNum(0,225)})`;
            }
        </script>
</body>
</html>